<template>
   <div class="con">
      <div class="header">
          <van-nav-bar title="超级养生" left-text="返回"  right-text="分享" left-arrow class="spec" @click-right='share()' @click-left='tab1()'>
           <van-icon name="cluster-o" slot="right"  />
           
            </van-nav-bar>
            <van-action-sheet v-model="show" title="分享到" height:30>
                <div class="share">
                    <share :config='config'></share>
                </div>
            </van-action-sheet>
      </div>
      <div class="main">
          <div class="banner">
              <img src="../assets/v1.gif" alt="">

              <img src="../assets/v2.gif" alt="">
              <img src="../assets/v3.gif" alt="">

          </div>
          <div class="tit">
              <img src="../assets/v5.gif" alt="">
          </div>
          <div class="goods">
             <router-link to='' tag='div'><img src="../assets/v4.gif" alt=""></router-link> 
             <router-link to='' tag='div'><img src="../assets/v4.gif" alt=""></router-link> 
             <router-link to='' tag='div'><img src="../assets/v4.gif" alt=""></router-link> 
          </div>
          <van-tabs type="card" @click="tab2">
                 <van-tab v-for="(title,i) in tit" :title="title" :key='i'>
                     <div class="m-tit">
                         <img src="../assets/v6.gif" alt="" >
                     </div>
                     <div class="goback-goods">
                        <ul>
                            <li v-for="(item,i) in list" :key='i' @click="detail(item.pid)">
                                <figure>
                                <img :src="item.pimg" alt="">
                                <figcaption>
                                    <p>{{item.pname}}</p>
                                    <p><span>￥{{item.pprice}}</span> <em>￥299</em></p>
                                    <div class="imetbuy">
                                        立即抢购
                                    </div>
                                    <b class="h-line1"></b>
                                    </figcaption> 
                                </figure>
                            </li>
                            
                        </ul>   
                     </div>
                </van-tab>
          </van-tabs>
      </div>
    </div>  
</template>

<script>
import * as api from '../../api/getproductlist'
export default {
    name:'Superhealth',
      data(){
        return{
            show:false,
            list:[],
            i:0,
            tit:['热销爆款','冬虫夏草','本草养生','海参蜂蜜','养眼精品'],
            config:{
                url: 'http://www.baidu.com', // 网址，默认使用 window.location.href
		source:'', // 来源（QQ空间会用到）, 默认读取head标签：<meta name="site" content="http://overtrue" />
		title: 'hello', // 标题，默认读取 document.title 或者 <meta name="title" content="share.js" />
		description: 'hi', // 描述, 默认读取head标签<meta name="description" content="PHP弱类型的实现原理分析" />
		image : '', // 图片, 默认取网页中第一个img标签
		sites: ['qq', 'weibo','qzone' ,], // 启用的站点
		wechatQrcodeTitle: '微信扫一扫：分享', // 微信二维码提示文字
		wechatQrcodeHelper  : '<p>微信里点“发现”，扫一下</p><p>二维码便可将本文分享至朋友圈。</p>'

            }
        }
    },
     methods:{
        tab1(){
            this.$router.go(-1)
        },
        share(){
            this.show=true
        },
        detail(id){
            this.$router.push("/detailpro/" + id);
        },
      tab2(name){
        this.i=name+1;
          api.gettypepro({classid:3,kindid:1,typeid:this.i}).then(data=>{
                this.list=data.data.data
            })
      } 
    },
        mounted(){
            api.gettypepro({classid:3,kindid:1,typeid:this.i+1}).then(data=>{
                this.list=data.data.data
            })
            
        }
}
</script>

<style scoped>
h2,h3,h4,p,figure,dl{
    margin: 0;
}
.goback-goods{
    background: #e5f2eb;
    min-height: 300px;
    padding: 0 12px;
    
}
.goback-goods ul{
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-top: -3px
}
.goback-goods ul li{
    width: 33%;
    flex-shrink: 0;
    position: relative;
    margin-bottom: 15px;
    background: #fff
}
.goback-goods ul li figure{
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 20px;
}
.goback-goods ul li figure img{
    margin-bottom: 20px;
    height: 130px;
    width: 100px
}
.goback-goods ul li figure figcaption p:first-child{
    font-size: 13px;
    margin-bottom: 10px;
    height: 30px;
}
.goback-goods ul li figure figcaption p:nth-of-type(2){
    font-size: 13px;
    margin-bottom: 5px
}
.goback-goods ul li figure figcaption p:nth-of-type(2) span{
    color: red;
    font-weight: 600;
    font-size: 14px;
    margin-right: 23px
}
.h-line1{
    display: block;
    width: 33px;
    height: 1px;
    background:#7f7f7f;
    position:absolute;
    right: 3px;
    bottom: 53px;
}
.goback-goods ul li figure figcaption p:nth-of-type(2) em{
    font-style: normal;
    color: #7f7f7f;
}
.imetbuy{
    width: 100%;
    height: 30px;
    background: #cc0000;
    line-height: 30px;
    text-align: center;
    color: #fff;
    font-size: 12px;
    margin-bottom: 10px
}
.goods{
    width: 100%;
    padding: 0 6px
}
.goods img{
    width: 100%;
}
.banner img{
    width: 100%;
    
}
.m-tit img{
    width: 100%
}
.tit img{
    width: 100%;
    
}
.banner>img:last-child{
    margin-top: -3px
}
.social-share{
    display: flex;
    justify-content: space-between;
    padding: 0 38px
}
.share{
    height: 100px;
}
.van-nav-bar__text{
    color: #000
}
.van-nav-bar .van-icon{
    color: #333;
    margin-top: 3px
}
.van-nav-bar__title{
    font-size: 15px
}
.con{
    display: flex;
    flex-direction: column;
    background:#f3f3f3;
    height: 100vh;
}
.main{
    flex: 1;
    overflow: auto;
    background:#e5f2eb 
}
</style>